<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: flow::util::Shared_ptr_alias_holder&lt; Target_ptr, Const_target_ptr &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Full implementation reference.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceflow.html">flow</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1util.html">util</a></li><li class="navelem"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">Shared_ptr_alias_holder</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classflow_1_1util_1_1Shared__ptr__alias__holder-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">flow::util::Shared_ptr_alias_holder&lt; Target_ptr, Const_target_ptr &gt; Class Template Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Convenience class template that endows the given subclass <code>T</code> with nested aliases <code>Ptr</code> and <code>Const_ptr</code> aliased to <code>shared_ptr&lt;T&gt;</code> and <code>shared_ptr&lt;const T&gt;</code> respectively.  
 <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-types" name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:aa4f1af88393042e60159a3a67f0accbc"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aa4f1af88393042e60159a3a67f0accbc">Ptr</a> = Target_ptr</td></tr>
<tr class="memdesc:aa4f1af88393042e60159a3a67f0accbc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Short-hand for ref-counted pointer to mutable values of type <code>Target_type::element_type</code> (a-la <code>T*</code>).  <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aa4f1af88393042e60159a3a67f0accbc">More...</a><br /></td></tr>
<tr class="separator:aa4f1af88393042e60159a3a67f0accbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef7998db71c60eeb5d1e3d1a97c14886"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aef7998db71c60eeb5d1e3d1a97c14886">Const_ptr</a> = Const_target_ptr</td></tr>
<tr class="memdesc:aef7998db71c60eeb5d1e3d1a97c14886"><td class="mdescLeft">&#160;</td><td class="mdescRight">Short-hand for ref-counted pointer to immutable values of type <code>Target_type::element_type</code> (a-la <code>T const *</code>).  <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aef7998db71c60eeb5d1e3d1a97c14886">More...</a><br /></td></tr>
<tr class="separator:aef7998db71c60eeb5d1e3d1a97c14886"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a55a247bb8fb2ec94b7cbfdd56be65a81"><td class="memTemplParams" colspan="2">template&lt;typename From_ptr &gt; </td></tr>
<tr class="memitem:a55a247bb8fb2ec94b7cbfdd56be65a81"><td class="memTemplItemLeft" align="right" valign="top">static <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aa4f1af88393042e60159a3a67f0accbc">Ptr</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81">ptr_cast</a> (const From_ptr &amp;ptr_to_cast)</td></tr>
<tr class="memdesc:a55a247bb8fb2ec94b7cbfdd56be65a81"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provides syntactic-sugary way to perform a <code>static_pointer_cast&lt;&gt;</code> from a compatible smart pointer type <code>From_ptr</code>, typically <code>From_ptr::element_type</code> being in the same class hierarchy as <code>Target_ptr::element_type</code>.  <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81">More...</a><br /></td></tr>
<tr class="separator:a55a247bb8fb2ec94b7cbfdd56be65a81"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a520b351b1463e585e278c8c7241b8fc8"><td class="memTemplParams" colspan="2">template&lt;typename From_ptr &gt; </td></tr>
<tr class="memitem:a520b351b1463e585e278c8c7241b8fc8"><td class="memTemplItemLeft" align="right" valign="top">static <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aef7998db71c60eeb5d1e3d1a97c14886">Const_ptr</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a520b351b1463e585e278c8c7241b8fc8">const_ptr_cast</a> (const From_ptr &amp;ptr_to_cast)</td></tr>
<tr class="memdesc:a520b351b1463e585e278c8c7241b8fc8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Identical to <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a> but adds <code>const</code>-ness (immutability) to the pointed-to type.  <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a520b351b1463e585e278c8c7241b8fc8">More...</a><br /></td></tr>
<tr class="separator:a520b351b1463e585e278c8c7241b8fc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac242f13a290877e84e44165e00a5905c"><td class="memTemplParams" colspan="2">template&lt;typename From_ptr &gt; </td></tr>
<tr class="memitem:ac242f13a290877e84e44165e00a5905c"><td class="memTemplItemLeft" align="right" valign="top">static <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aa4f1af88393042e60159a3a67f0accbc">Ptr</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#ac242f13a290877e84e44165e00a5905c">dynamic_ptr_cast</a> (const From_ptr &amp;ptr_to_cast)</td></tr>
<tr class="memdesc:ac242f13a290877e84e44165e00a5905c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a> but a <code>dynamic_pointer_cast</code> instead of static.  <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#ac242f13a290877e84e44165e00a5905c">More...</a><br /></td></tr>
<tr class="separator:ac242f13a290877e84e44165e00a5905c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a013713e08c6537f91d6bdba29fcccdff"><td class="memTemplParams" colspan="2">template&lt;typename From_ptr &gt; </td></tr>
<tr class="memitem:a013713e08c6537f91d6bdba29fcccdff"><td class="memTemplItemLeft" align="right" valign="top">static <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aef7998db71c60eeb5d1e3d1a97c14886">Const_ptr</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a013713e08c6537f91d6bdba29fcccdff">dynamic_const_ptr_cast</a> (const From_ptr &amp;ptr_to_cast)</td></tr>
<tr class="memdesc:a013713e08c6537f91d6bdba29fcccdff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Identical to <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a520b351b1463e585e278c8c7241b8fc8" title="Identical to ptr_cast() but adds const-ness (immutability) to the pointed-to type.">const_ptr_cast()</a> but a <code>dynamic_pointer_cast</code> instead of static.  <a href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a013713e08c6537f91d6bdba29fcccdff">More...</a><br /></td></tr>
<tr class="separator:a013713e08c6537f91d6bdba29fcccdff"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><div class="compoundTemplParams">template&lt;typename Target_ptr, typename Const_target_ptr&gt;<br />
class flow::util::Shared_ptr_alias_holder&lt; Target_ptr, Const_target_ptr &gt;</div><p >Convenience class template that endows the given subclass <code>T</code> with nested aliases <code>Ptr</code> and <code>Const_ptr</code> aliased to <code>shared_ptr&lt;T&gt;</code> and <code>shared_ptr&lt;const T&gt;</code> respectively. </p>
<p >In addition a few syntactic-sugary <code>static</code> methods are provided, in particular to perform shared pointer versions of <code>static_cast&lt;T*&gt;</code> and <code>dynamic_cast&lt;T*&gt;</code>.</p>
<h3>When to use</h3>
<p >The following assumes you are familiar with <code>shared_ptr</code> (<code>boost::</code> and <code>std::</code> are basically equivalent). Mechanically speaking, if class <code>C</code> subclasses <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a>, then, simply, you gain a shorter way to write <code>boost::shared_ptr&lt;C&gt;</code> and <code>boost::shared_ptr&lt;const C&gt;</code>; plus briefer ways to cast down-class polymorphic <code>shared_ptr</code>s to those types (e.g., if <code>C2</code> derives from <code>C</code>, and one has a <code>shared_ptr&lt;C2&gt;</code> but needs a <code>shared_ptr&lt;C&gt;</code>). It is prettier and more pleasant to write <code>C::Ptr</code>, <code>C::Const_ptr</code>, <code>C::ptr_cast(p)</code>, etc., which may not seem like much, but in our experience it adds up over time. (Some coders aren't familiar with <code>{boost|std}::{static|dynamic}_pointer_cast()</code>, for example, so it's nice to provide equivalents "out of the box.")</p>
<p >However, in addition to these mechanical niceties, subclassing <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a> indicates the intention that the inheriting class <code>C</code> is to be used with the <em>shared ownership pattern</em>: essentially, that:</p><ol type="1">
<li><code>C</code>s are passed around by pointer, not by value;</li>
<li>a <code>C</code> is generated via the factory pattern only and returned pre-wrapped in a <code>shared_ptr</code>; and</li>
<li>a <code>C</code> is to be destroyed automatically once all outside <em>and</em> inside (to <code>C</code> code itself) references to that <code>C</code> have disappeared.</li>
</ol>
<p >It may be tempting to derive from <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a> for every class ever: who doesn't like syntactic sugar? We recommend restraint, however. We recommend you do so if and only if <code>C</code> is indeed intended to be used per the above 3 bullet points (shared ownership pattern).</p>
<p >For example, <a class="el" href="classflow_1_1net__flow_1_1Node.html" title="An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a di...">net_flow::Node</a> is just a (rather big) class, intended to be used in boring ways, such as on the stack; and so it lacks any <code>Node::Ptr</code>. However, it stores (internally) tables of <a class="el" href="classflow_1_1net__flow_1_1Peer__socket.html" title="A peer (non-server) socket operating over the Flow network protocol, with optional stream-of-bytes an...">net_flow::Peer_socket</a> objects, and it also returns them for public use via factory methods such as <code>Node::connect() -&gt; Peer_socket::Ptr</code>. A <a class="el" href="classflow_1_1net__flow_1_1Peer__socket.html" title="A peer (non-server) socket operating over the Flow network protocol, with optional stream-of-bytes an...">net_flow::Peer_socket</a> is never "out in the
wild" without a wrapping <code>shared_ptr</code>; hence it &ndash; unlike <code><a class="el" href="classflow_1_1net__flow_1_1Node.html" title="An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a di...">net_flow::Node</a></code> &ndash; derives from <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a>. Once both the <code>Node</code> user has finishes with a given <code>Peer_socket</code>, and the <code>Node</code> has also deleted it from its internal structures, the <code>Peer_socket</code> is deleted automatically.</p>
<p >In particular, the <em>mere</em> fact that you want to use <em>a</em> <code>shared_ptr&lt;&gt;</code> with some class <code>C</code> &ndash; and there are many such situations &ndash; is not sufficient to endow <code>C</code> with a <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a> parent. It is more intended for when you want to use <code>C</code> with <em>only</em> <code>shared_ptr</code>s and in no other fashion. <code>shared_ptr</code> is still useful in a less expansive role, without <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a> or the pattern the latter encourages.</p>
<h3>How to use</h3>
<p ><code>T</code> would typically <code>public</code>ly subclass <code><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a>&lt;shared_ptr&lt;T&gt;, shared_ptr&lt;T const&gt;&gt;</code>, where <code>shared_ptr</code> is either <code>boost::shared_ptr</code> or <code>std::shared_ptr</code> (or some other semantically identical ref-counting pointer class template). It's also reasonable to use <code>protected</code> or <code>private</code> inheritance. Behavior is undefined in any other use case.</p>
<p >It is not recommended to have <code>C2</code> derive from us, if <code>C</code> already derives from us, and <code>C2</code> is a subclass of <code>C</code> (directly or indirectly). At that point <code>C2::Ptr</code> might refer to either alias, so compilation will likely fail when trying to use it, and browbeating it into working &ndash; even if achieved &ndash; is unlikely to result in syntactically pleasant code... which was the whole point in the first place. So, don't do that. If you need this stuff at multiple levels of a hierarchy, then it's probably best to just define the nested <code>Ptr</code> (etc.) manually. (It really isn't that hard in the first place... but reduced boiler-plate is reduced boiler-plate.)</p>
<p >Also, if your <code>T</code> requires being an aggregate type &ndash; such as if you intend to use <code>{}</code> direct member init &ndash; then you can't derive from anything, including us, and will have to make a manual <code>Ptr</code> (etc.). Note that's true of other similar utilities like <code>boost::noncopyable</code>.</p>
<h3>Rationale</h3>
<p >Why have this at all? Answer: It was tiring to keep manually making <code>using Ptr = shared_ptr&lt;X&gt;</code> nested aliases. Casting to <code>Ptr</code> in pretty fashion was also annoying to keep reimplementing. Down with boiler-plate!</p>
<p >Why not take a single template arg, the target type <code>T</code>? Answer: That would've been fine, but it seemed nice to be able to support not just specifically one of <code>"{std|boost|...}::shared_ptr"</code> but all of them. Admittedly it's a bit uglier when declaring its use in the <code>class</code> or <code>struct</code> declaration; but since that's a one-time thing, trade-off seems worth it.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Target_ptr</td><td>Supposing the intended subclass is <code>T</code>, this must be <code>shared_ptr&lt;T&gt;</code>, where <code>shared_ptr</code> is a class template with <code>std::shared_ptr</code> semantics; namely at least <code>std::shared_ptr</code> itself and <code>boost::shared_ptr</code>. </td></tr>
    <tr><td class="paramname">Const_target_ptr</td><td>Same as <code>Target_ptr</code> but pointing to immutable object: <code>shared_ptr&lt;T const&gt;</code>. Note behavior is undefined if the <code>T</code> in <code>Const_target_ptr</code> isn't the same <code>T</code> as in <code>Target_ptr</code>; or if the <code>shared_ptr</code> template is different between the two (e.g., one uses <code>std::</code>, the other <code>boost::</code>). Update: It is now recommended to leave this at its default. Had the authors originally known about <code>pointer_traits::rebind</code> this would never have been a parameter in the first place. We are leaving it in for compatibility with existing code.</td></tr>
  </table>
  </dd>
</dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000154">Todo:</a></b></dt><dd><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">flow::util::Shared_ptr_alias_holder</a> <code>Const_target_ptr</code> is deprecated and shall be always left at its default value in future code; eventually remove it entirely and hard-code the default value internally.</dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000155">Todo:</a></b></dt><dd><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">flow::util::Shared_ptr_alias_holder</a>, such as it is, may well largely work for <code>unique_ptr</code> and other smart/fancy pointer types; should be generalized both in name (if possible) and capabilities (if not already the case). Could be just a matter of updating docs and renaming (deprecated-path alias may be required to avoid a breaking change); or not. Needs a bit of investigation to determine such details. (The author (ygoldfel) was conisderably less advanced when this was originally made versus the time of this writing... maybe a decade+? He meant well though.)</dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000156">Todo:</a></b></dt><dd>Add example usage snippets in <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html" title="Convenience class template that endows the given subclass T with nested aliases Ptr and Const_ptr ali...">Shared_ptr_alias_holder</a> doc header, illustrating the pattern. </dd></dl>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00119">119</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="aef7998db71c60eeb5d1e3d1a97c14886" name="aef7998db71c60eeb5d1e3d1a97c14886"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef7998db71c60eeb5d1e3d1a97c14886">&#9670;&nbsp;</a></span>Const_ptr</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Target_ptr , typename Const_target_ptr &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">flow::util::Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;::Const_ptr =  Const_target_ptr</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Short-hand for ref-counted pointer to immutable values of type <code>Target_type::element_type</code> (a-la <code>T const *</code>). </p>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00127">127</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>

</div>
</div>
<a id="aa4f1af88393042e60159a3a67f0accbc" name="aa4f1af88393042e60159a3a67f0accbc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa4f1af88393042e60159a3a67f0accbc">&#9670;&nbsp;</a></span>Ptr</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Target_ptr , typename Const_target_ptr &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">flow::util::Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;::Ptr =  Target_ptr</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Short-hand for ref-counted pointer to mutable values of type <code>Target_type::element_type</code> (a-la <code>T*</code>). </p>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00125">125</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a520b351b1463e585e278c8c7241b8fc8" name="a520b351b1463e585e278c8c7241b8fc8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a520b351b1463e585e278c8c7241b8fc8">&#9670;&nbsp;</a></span>const_ptr_cast()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Target_ptr , typename Const_target_ptr &gt; </div>
<div class="memtemplate">
template&lt;typename From_ptr &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;<a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aef7998db71c60eeb5d1e3d1a97c14886">::Const_ptr</a> <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">flow::util::Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;::const_ptr_cast </td>
          <td>(</td>
          <td class="paramtype">const From_ptr &amp;&#160;</td>
          <td class="paramname"><em>ptr_to_cast</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Identical to <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a> but adds <code>const</code>-ness (immutability) to the pointed-to type. </p>
<p >So if <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a> casts from <code>A*</code> to <code>B*</code>, this casts from <code>A*</code> to <code>B const *</code> (a/k/a <code>const B*</code>).</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">From_ptr</td><td>See <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr_to_cast</td><td>The smart pointer to cast. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result of the cast. </dd></dl>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00197">197</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>

</div>
</div>
<a id="a013713e08c6537f91d6bdba29fcccdff" name="a013713e08c6537f91d6bdba29fcccdff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a013713e08c6537f91d6bdba29fcccdff">&#9670;&nbsp;</a></span>dynamic_const_ptr_cast()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Target_ptr , typename Const_target_ptr &gt; </div>
<div class="memtemplate">
template&lt;typename From_ptr &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;<a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aef7998db71c60eeb5d1e3d1a97c14886">::Const_ptr</a> <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">flow::util::Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;::dynamic_const_ptr_cast </td>
          <td>(</td>
          <td class="paramtype">const From_ptr &amp;&#160;</td>
          <td class="paramname"><em>ptr_to_cast</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Identical to <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a520b351b1463e585e278c8c7241b8fc8" title="Identical to ptr_cast() but adds const-ness (immutability) to the pointed-to type.">const_ptr_cast()</a> but a <code>dynamic_pointer_cast</code> instead of static. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">From_ptr</td><td>See <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr_to_cast</td><td>The smart pointer to cast. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result of the cast. Recall this may be an empty (null) pointer. </dd></dl>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00218">218</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>

</div>
</div>
<a id="ac242f13a290877e84e44165e00a5905c" name="ac242f13a290877e84e44165e00a5905c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac242f13a290877e84e44165e00a5905c">&#9670;&nbsp;</a></span>dynamic_ptr_cast()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Target_ptr , typename Const_target_ptr &gt; </div>
<div class="memtemplate">
template&lt;typename From_ptr &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;<a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aa4f1af88393042e60159a3a67f0accbc">::Ptr</a> <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">flow::util::Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;::dynamic_ptr_cast </td>
          <td>(</td>
          <td class="paramtype">const From_ptr &amp;&#160;</td>
          <td class="paramname"><em>ptr_to_cast</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Equivalent to <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a> but a <code>dynamic_pointer_cast</code> instead of static. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">From_ptr</td><td>See <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#a55a247bb8fb2ec94b7cbfdd56be65a81" title="Provides syntactic-sugary way to perform a static_pointer_cast&lt;&gt; from a compatible smart pointer type...">ptr_cast()</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr_to_cast</td><td>The smart pointer to cast. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result of the cast. Recall this may be an empty (null) pointer. </dd></dl>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00207">207</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>

</div>
</div>
<a id="a55a247bb8fb2ec94b7cbfdd56be65a81" name="a55a247bb8fb2ec94b7cbfdd56be65a81"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a55a247bb8fb2ec94b7cbfdd56be65a81">&#9670;&nbsp;</a></span>ptr_cast()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Target_ptr , typename Const_target_ptr &gt; </div>
<div class="memtemplate">
template&lt;typename From_ptr &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;<a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html#aa4f1af88393042e60159a3a67f0accbc">::Ptr</a> <a class="el" href="classflow_1_1util_1_1Shared__ptr__alias__holder.html">flow::util::Shared_ptr_alias_holder</a>&lt; Target_ptr, Const_target_ptr &gt;::ptr_cast </td>
          <td>(</td>
          <td class="paramtype">const From_ptr &amp;&#160;</td>
          <td class="paramname"><em>ptr_to_cast</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Provides syntactic-sugary way to perform a <code>static_pointer_cast&lt;&gt;</code> from a compatible smart pointer type <code>From_ptr</code>, typically <code>From_ptr::element_type</code> being in the same class hierarchy as <code>Target_ptr::element_type</code>. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">From_ptr</td><td>See type of arg to <code>std::static_pointer_cast&lt;&gt;()</code> or <code>boost::static_pointer_cast&lt;&gt;()</code>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr_to_cast</td><td>The smart pointer to cast. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Result of the cast. </dd></dl>

<p class="definition">Definition at line <a class="el" href="shared__ptr__alias__holder_8hpp_source.html#l00187">187</a> of file <a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>util/<a class="el" href="shared__ptr__alias__holder_8hpp_source.html">shared_ptr_alias_holder.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:36 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
